﻿if (typeof (Five) == 'undefined')
    Five = {};
if (typeof (Five.Cart) == 'undefined')
    Five.Cart = {};

Five.Cart.Detail = {
    InitEvent: function () {
        $("[id$='txtQuantity']").keydown(function (e) {
            var key = e.charCode || e.keyCode || 0;
            if (key == 48 || key == 49 || key == 50 || key == 51 || key == 52 || key == 53 ||
                key == 54 || key == 55 || key == 56 || key == 57) {
                if (($(this).val() + 1) > 1000) {
                    return false;
                }
            }
            else {
                return false;
            }
        });
        $("[id$='txtQuantity']").keyup(function (e) {
            var key = e.charCode || e.keyCode || 0;
            if (key == 48 || key == 49 || key == 50 || key == 51 || key == 52 || key == 53 ||
                key == 54 || key == 55 || key == 56 || key == 57) {
                Five.Cart.UpdateQuantity($(this).attr("pi"), $(this).val());
            }
        });
    }
}

$(function () {
    Five.Cart.Detail.InitEvent();
});